package org.shiwen.week12.answer;

public class Q7 {
    public static void main(String[] args) {
        int sum = 0;
        int result = 1;
        int i = 1;
        while(sum<=9999){
            sum = i*result+sum;
            i = i*result;
            result++;
        }
        System.out.println(result-2);
    }
}
